package com.chinacoal.microservice;

import com.chinacoal.microservice.fallback.RoomManagementClientFallback;
import com.chinacoal.microservice.pojo.CcmsSmartleasingDeviceChange;
import com.chinacoal.microservice.pojo.CcmsSmartleasingRoom;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 房源管理-房间管理-对外开发接口类
 * @date 2020-11-12 10：29
 */
@Api(tags = {"房源管理-房间管理"})
@FeignClient(name = "${spring.application.name}",fallback = RoomManagementClientFallback.class,configuration = FeignAutoConfiguration.class)
public interface RoomManagementClient {

    /**
     * @Description: 查询所有的房间信息（带分页）
     * @author zhuliang
     * @date 2020/11/12 10:53
     */
    @ApiOperation(value = "查询所有的房间信息（带分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件实体类", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/roomManagement/getListByPage")
    public Result<List<CcmsSmartleasingRoom>> getListByPage(@RequestBody QueryCriteria queryCriteria,
                                                            @RequestHeader("token") String token);

    /**
     * @Description: 根据房间id查询房间信息
     * @author zhuliang
     * @date 2020/11/12 11:24
     */
    @ApiOperation(value = "根据房间id查询房间信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkRoomId", value = "房间ID", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/roomManagement/getRoomById/{pkRoomId}")
    public Result<CcmsSmartleasingRoom> getRoomById(@PathVariable(value = "pkRoomId") String pkRoomId,
                                                    @RequestHeader("token") String token);

    /**
     * @Description: 添加房间信息
     * @author zhuliang
     * @date 2020/11/12 11:35
     */
    @ApiOperation(value = "添加房间信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "body", name = "room", value = "房间ID", required = true, dataType = "CcmsSmartleasingRoom")
    })
    @PostMapping("smartleasing/roomManagement/addRoom")
    public Result addRoom(@RequestHeader("token") String token,
                          @RequestBody CcmsSmartleasingRoom room);

    /**
     * @Description: 修改房间信息
     * @author zhuliang
     * @date 2020/11/12 11:41
     */
    @ApiOperation(value = "修改房间信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "body", name = "room", value = "房间实体类", required = true, dataType = "CcmsSmartleasingRoom")
    })
    @PutMapping("smartleasing/roomManagement/updateRoom")
    public Result updateRoom(@RequestHeader("token") String token,
                             @RequestBody CcmsSmartleasingRoom room);

    /**
     * @Description: 根据房间id批量删除房间信息
     * @author zhuliang
     * @date 2020/11/12 11:46
     */
    @ApiOperation(value = "根据房间id批量删除房间信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "path", name = "deleteId", value = "要删除的id字符串", required = true, dataType = "String")
    })
    @DeleteMapping("smartleasing/roomManagement/deleteRoom/{deleteId}")
    public Result deleteRoom(@RequestHeader("token") String token,
                             @PathVariable(value = "deleteId",required = false) String deleteId);

    /**
     * @Description: 条件查询（带分页）
     * @author zhuliang
     * @date 2020/11/12 17:35
     */
    @ApiOperation(value = "条件查询（带分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件实体", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/roomManagement/queryRoomManagement")
    public Result<List<CcmsSmartleasingRoom>> queryRoomManagement(@RequestBody QueryCriteria queryCriteria,
                                                                  @RequestHeader("token") String token);

    /**
     * @Description: 修改出租信息
     * @author zhuliang
     * @date 2020/12/2 15:03
     */
    @ApiOperation(value = "修改出租信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "room", value = "房间实体类", required = true, dataType = "CcmsSmartleasingRoom"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PutMapping("smartleasing/roomManagement/updateByRent")
    public Result updateByRent(@RequestBody CcmsSmartleasingRoom room,
                               @RequestHeader("token") String token);

    /**
     * @description
     * @author leo
     * @date 2022-12-18 11:33
     */
    @ApiOperation(value="添加换表")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "deviceChange", value = "房间实体类", required = true, dataType = "CcmsSmartleasingDeviceChange"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/roomManagement/addDeviceChange")
    public Result addDeviceChange(@RequestHeader("token") String token,
                                  @RequestBody CcmsSmartleasingDeviceChange deviceChange
                               );

    /**
     * @description
     * @author leo
     * @date 2022-12-19 18:09
     */
    @ApiOperation(value = "根据房间id查询换表信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkRoomId", value = "房间ID", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "path", name = "bCurrentMonth", value = "查询当月数据吗", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/roomManagement/getDeviceChangesByRoomId_CurrentMonth/{pkRoomId}/{bCurrentMonth}")
    public Result<List<CcmsSmartleasingDeviceChange>> getDeviceChangesByRoomId_CurrentMonth(@PathVariable(value = "pkRoomId") String pkRoomId,
                                                    @PathVariable(value="bCurrentMonth") String bCurrentMonth,
                                                    @RequestHeader("token") String token);

}
